// import * as React from 'react';
export const schema = {
    type: "page",
    title: "提现申请审批",
    body: {
        type: "crud",
        api: "/api/cash",
        columnsTogglable: true,
        // primaryField: 'user_id',
        filter: {
            title: "",
            submitText: "",
            panelClassName: 'm-b-none bg-gd no-border',
            bodyClassName: 'wrapper-sm',
            mode: "inline",
            controls: [
                {
                    type: "text",
                    name: "keyword",
                    placeholder: "银行账号/团队名称/提现手机号",
                    style: {minWidth: 260},
                    addOn: {
                        type: "submit",
                        label: "搜索",
                        primary: true
                    }
                }
            ]
        },
        columns: [
            {
                name: "created_at",
                label: "申请提款日期",
                width: 150
            },
            {
                name: "org_id",
                label: "所属机构",
                type: "tpl",
                tpl: `<% if (data.acl.can("org:view") && data.org) { %>
                    <a data-link='/org/view/<%= data.org.id %>'><%=  data.org.name %></a>
                    <% } else { %>
                        <span><%= data.org ? data.org.name : '-' %></span>
                        <% } %>`
            },
            {
                label: "团队名称",
                name: "team.name"
            },
            {
                label: "订单数",
                name: "order_count"
            },
            {
                label: "总额",
                name: 'amount'
            },
            {
                label: "手续费",
                name: 'service_fee'
            },
            {
                label: "用户可到账总额",
                name: 'transfer_fee',
            },
            {
                label: "提款用途",
                name: 'apply_msg',
            },
            {
                label: "申请状态",
                name: 'verify_status',
                type: "map",
                map: {
                    "0": "<span class='label label-warning'>待审核</span>",
                    "1": "<span class='label label-success'>审核通过</span>",
                    "2": "<span class='label label-default'>审核不通过</span>",
                    "*": "${status}"
                }
            },
            {
                label: "备注信息",
                name: 'verify_msg',
            },
            {
                label: "订单人员明细",
                name: 'real_name',
                type: "tpl",
                tpl: "<a data-link='/finance/order/list?cash_apply_id=${id}'>查看</a>"
            },
            {
                type: "operation",
                label: "收款账号",
                // width: 180,
                buttons: [
                    {
                        type: "button",
                        size: "xs",
                        label: "查看",
                        level: "info",
                        actionType: "dialog",
                        dialog: {
                            disabled: true,
                            title: "收款账号信息",
                            body: `
                                <div class="text-center" style="overflow: auto;">
                                    <div class="form-group form-item form-item-static">
                                        <label class="col-sm-5 control-label">户名</label>
                                        <div class="col-sm-7">
                                            <div class="form-control-static"><%= data.recive_info ? data.recive_info.bank_card_account : '-' %></div>
                                        </div>
                                    </div>
                                    <div class="form-group form-item form-item-static">
                                        <label class="col-sm-5 control-label">账号</label>
                                        <div class="col-sm-7">
                                            <div class="form-control-static"><%= data.recive_info ? data.recive_info.bank_card_num : '-' %></div>
                                        </div>
                                    </div>
                                    <div class="form-group form-item form-item-static" >
                                        <label class="col-sm-5 control-label">开户银行</label>
                                        <div class="col-sm-7">
                                            <div class="form-control-static"><%= data.recive_info ? data.recive_info.bank_company : '-' %></div>
                                        </div>
                                    </div>
                                    <div class="form-group form-item form-item-static" >
                                        <label class="col-sm-5 control-label">开户支行</label>
                                        <div class="col-sm-7">
                                            <div class="form-control-static"><%= data.recive_info ? data.recive_info.bank_branch : '-' %></div>
                                        </div>
                                    </div>
                                    <div class="form-group form-item form-item-static" >
                                        <label class="col-sm-5 control-label">开户行地址</label>
                                        <div class="col-sm-7">
                                            <div class="form-control-static"><%= data.recive_info ? data.recive_info.bank_card_open_addr : '-' %></div>
                                        </div>
                                    </div>
                                </div>
                            `
                        }
                    }],
            },

            {
                label: "操作",
                type: "operation",
                // width: 180,
                buttons: [
                    {
                        visibleOn: 'data.verify_status == 0',
                        type: "button",
                        label: "审核通过",
                        size: "xs",
                        level: "success",
                        actionType: "ajax",
                        confirmText: "确定要审核通过？一旦提交将不能修改",
                        api: "/api/cash/verify/${id}?verify_status=1"
                    },
                    {
                        visibleOn: 'data.verify_status == 0',
                        type: "button",
                        size: "xs",
                        label: "审核不通过",
                        level: "danger",
                        actionType: "ajax",
                        api: "/api/cash/verify/${id}?verify_status=2",
                        confirmText: "确定要审核不通过？一旦提交将不能修改",
                    },
                    {
                        type: "button",
                        size: "xs",
                        label: "添加备注",
                        level: "info",
                        actionType: "dialog",
                        dialog: {
                            title: "备注信息",
                            body: {
                                type: "form",
                                api: "post:/api/cash/verify/${id}",
                                controls: [
                                    {
                                        label: '备注信息',
                                        type: "textarea",
                                        name: "verify_msg",
                                        placeholder: "备注信息、如状态、银行流水单号等",
                                    }
                                ]
                            }
                        }
                    },
                ],
            }
        ]
    }
};
